<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
</body>
  <script>
    let data = {
      name: {
        last: 'ssss',
        first: {
          a: {
            b: {
              z: 'zzz'
            },
            c: 'c'
          }
        }
      }
    }
    let path = 'name.first.a.c'
    function getValueByPath (data, path) {
      let pathArr = path.split('.')
      let res = data;
      let prop;
      while (prop = pathArr.shift()) {
        res = res[prop]
      }
      return res
    }

    let result = getValueByPath(data, path)
    console.log(result)
  </script>

</html>